<%@ page import="com.po.Comment" %>
<%@ page import="java.util.List" %>
<%@ page isErrorPage="true" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    HttpSession session1 = request.getSession(false);
    String note_name = null;
    String note_content = null ;
    int note_id =0;
    if (session1 == null || session1.getAttribute("id") == null) {
        response.sendRedirect(request.getContextPath() + "/index.jsp");
    } else {
        note_name = (String) request.getAttribute("note_name");
        note_content = (String) request.getAttribute("note_content");
        note_id = (int) request.getAttribute("note_id");
    }
    List<Comment> comment = (List<Comment>) request.getAttribute("comment");
%>
<a style="text-align: end" href="<%=request.getContextPath()%>/comment/createComment.jsp?note_id=<%=note_id%>&note_name=<%=session.getAttribute("note_name")%>&note_content=<%=session.getAttribute("note_content")%>">来参与评论</a>
<div style="text-align: right">
<a style="text-align: end" href="<%=request.getContextPath()%>/leaveEnvelope">返回信封区</a>
</div>
<h3>信封名字：<%=session.getAttribute("note_name")%></h3><br>
<h3>信封内容：<%=session.getAttribute("note_content")%></h3>
<hr>

<%
    if (comment.isEmpty()) {
        out.print("该纸条还没有人评论，快来参与评论");
    } else {
        for (Comment comment1 : comment) {
%>
<p>
    用户：<%=comment1.getUser_name()%>:<br><br>
    <%=comment1.getContent()%>
</p>
<hr color="pink">
<%
        }
    }
%>
<style>
    body{
        background-image: url("../picture/new.jpg");
        background-repeat: no-repeat;
        background-attachment: fixed;
        background-position: center center;
        background-size: 100% 100%;
    }
</style>
